<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var arr = [1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4]
    var result = arr.reduce((pre, cur) => {
        console.log(cur)
        const index = pre.findIndex(o => o.value === cur)
        if (index <= -1) {
            pre.push({
                value: cur,
                count: 1
            })
        } else {
            pre[index].count++
        }
        return pre
    }, []);

    console.log(result)

    // var k = result.filter(i => i.count > 2)
    // var q = k.map(i => i.value)
    // console.log(result)
</script>
</body>
</html>